# Copyright (C) 2006, 2007  Stephane Alnet
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

#
# For more information visit http://carrierclass.net/
#

use strict;
use warnings;

package CCNProxy::Model::Customer;

use Jifty::DBI::Schema;

use CCNCore::Record schema {

    column username =>        # [subscriber:username, avp(from_user):value]
        type is 'text',
        is mandatory,
        since '0.0.1',
        label is 'Username',
        hints is 'If using registration to authenticate and locate the device, enter its username.',
    ;

    # Authenticate and locate
    column password =>       # [subscriber:password+ha1+ha1b]
        type is 'text',
        since '0.0.1',
        label is 'Password',
        hints is 'If using registration to authenticate and locate the device, enter its password.',
    ;

    # Authenticate only (locate is done using cfa/cfnr)
    column host =>    # [avp(from_user):key]
        type is 'text',
        since '0.0.1',
        label is 'Host IP Address',
        hints is 'If using IP address to authenticate, enter its IP address. Do not forget to create a CFA or CFNR URI pointing to this host for inbound numbers.'
    ;

    # Information for calls coming from this customer.
    column callerid =>       # [avp(rpid) if present]   NULL for no callerID override
        type is 'text',
        since '0.0.1',
        label is 'Caller-ID',
        hints is 'Override the Caller-ID number.',
    ;
    
    # Information for calls coming from this customer.
    column clear_callerid =>  # [avp(clear_rpid) if present]
        type is 'boolean',
        default is 'FALSE',
        is mandatory,
        valid_values are
            { display => 'Yes', value => 'TRUE' },
            { display => 'No',  value => 'FALSE' },
        since '0.0.1',
        label is 'Clear Caller-ID',
        hints is 'Clear the Caller-ID number on outbound calls.',
    ;
    
    column default_NPA =>    # [avp(default_npa)] NPA to use for 7-digits dialing (if allowed)
        type is 'text',
        is mandatory,
        since '0.0.1',
        label is 'Default NPA',
        hints is 'Default NPA for 7 digits dialing.'
    ;

    column allow_local =>     # [avp(allow_local)]
        type is 'boolean',
        is mandatory,
        valid_values are
            { display => 'Yes', value => 'TRUE' },
            { display => 'No',  value => 'FALSE' },
        since '0.0.1',
        label is 'Allow local calls',
        hints is 'Indicate whether the device can place local calls.'
    ;

    column allow_ld =>        # [avp(allow_ld)]
        type is 'boolean',
        is mandatory,
        valid_values are
            { display => 'Yes', value => 'TRUE' },
            { display => 'No',  value => 'FALSE' },
        since '0.0.1',
        label is 'Allow long distance calls',
        hints is 'Indicate whether the device can place long distance calls.'
    ;

    column allow_premium =>   # [avp(allow_premium)]
        type is 'boolean',
        is mandatory,
        valid_values are
            { display => 'Yes', value => 'TRUE' },
            { display => 'No',  value => 'FALSE' },
        since '0.0.1',
        label is 'Allow Premium calls',
        hints is 'Indicate whether the device can place Premium calls.'
    ;

    column allow_intl =>      # [avp(allow_intl)]
        type is 'boolean',
        is mandatory,
        valid_values are
            { display => 'Yes', value => 'TRUE' },
            { display => 'No',  value => 'FALSE' },
        since '0.0.1',
        label is 'Allow international calls',
        hints is 'Indicate whether the device can place international calls.'
    ;

};

use CCNCore::Mixin::Active;
use CCNCore::Mixin::FancyName;
use CCNProxy::Mixin::Domain;

sub since { 0.0.1 }
sub menu { 'User side' }

1;